
/**
* 校验库
**/
Validator = {
	Time : /^(([0-1][0-9])|2[0-3]):[0-5][0-9]:[0-5][0-9]$/,
	Email : /^[\u0391-\uFFE5\w]+[-+.\u0391-\uFFE5\w]*@\w+([-.]\w+)*\.\w+([-.]\w+)*$/,
	Tel : /^((\+)?\d{2,3}(-)?)?((0)?\d{2,3}(-)?)?[1-9]\d{6,8}((-)\d{1,4})?$/,
	Mobile : /^((\+)?\d{2,3}(-)?)?(0)?1[35]\d{9}$/,
	Url : /^http:\/\/[A-Za-z0-9]+\.[A-Za-z0-9]+[\/=\?%\-&_~`@[\]\':+!]*([^<>\"\"])*$/,
	IdCard : /^(\d{17}|\d{14})[\da-zA-Z]$/,
	BankCard : /^(\d{16}|\d{19})$/,
	CheckNo : /^[A-Za-z0-9]+$/,
	OrgId : /^(\d{15}|\d{13})$/,
	OrgCode : /^[A-Z0-9]{8}(-)?[A-Z0-9]{1}]?$/,
	OfficerId : /^\d{7}$/,
	Passport:/^[A-Z\d]{7,9}$/,
	Currency : /^\d+(\.\d+)?$/,
	DateFormat:  /^([1-2]{1}[0-9]{3}(-){1}(([0]{1}[1-9]{1})|([1]{1}[0-2]{1}))(-){1}(([0]{1}[1-9]{1})|([1-2]{1}[0-9]{1})|([3]{1}[0-1]{1})))?$/,
	Date:  /^((\d{2}(([02468][048])|([13579][26]))[\-\/\s]?((((0?[13578])|(1[02]))[\-\/\s]?((0?[1-9])|([1-2][0-9])|(3[01])))|(((0?[469])|(11))[\-\/\s]?((0?[1-9])|([1-2][0-9])|(30)))|(0?2[\-\/\s]?((0?[1-9])|([1-2][0-9])))))|(\d{2}(([02468][1235679])|([13579][01345789]))[\-\/\s]?((((0?[13578])|(1[02]))[\-\/\s]?((0?[1-9])|([1-2][0-9])|(3[01])))|(((0?[469])|(11))[\-\/\s]?((0?[1-9])|([1-2][0-9])|(30)))|(0?2[\-\/\s]?((0?[1-9])|(1[0-9])|(2[0-8]))))))(\s(((0?[0-9])|([1][0-9])|([2][0-3]))\:([0-5]?[0-9])((\s)|(\:([0-5]?[0-9])))))?$/,
	DateTime:  /^([1-2]{1}[0-9]{3}(-){1}(([0]{1}[1-9]{1})|([1]{1}[0-2]{1}))(-){1}(([0]{1}[1-9]{1})|([1-2]{1}[0-9]{1})|([3]{1}[0-1]{1}))[ ]{1}(([0-1]{1}[0-9]{1})|([2]{1}[0-3]{1}))(:){1}[0-5]{1}[0-9]{1}(:){1}[0-5]{1}[0-9]{1})?$/,
	Number : /^\d+$/,
	PositiveInt : /^[0-9]*[1-9][0-9]*$/,
	Zip : /^[1-9]\d{5}$/,
	Integer : /^[-\+]?\d{1,9}$/,
	NonnegativeInt : /^[0-9]{1,8}$/,
	Long : /^\d{1,18}$/,
	Half : /^[A-Za-z0-9]+$/,
	Hex : /^[A-Fa-f0-9]+$/,
	Double : /^[-\+]?\d+(\.\d+)?$/,
	English : /^[A-Za-z]+$/,
	Chinese :  /^[\u0391-\uFFE5]+$/,
	Username : /^[a-z]\w{3,}$/i,
	Amount: /^[-\+]?(([0-9]{1,7})?(\.\d{0,2})?)$/,
	UnSafe : /^(([A-Z]*|[a-z]*|\d*|[-_\~!@#\$%\^&\*\.\(\)\[\]\{\}<>\?\\\/\'\"]*)|.{0,5})$|\s/,
	CardBill : /^\d{12}$/,
	Ip : /^((2[0-4]\d|25[0-5]|[01]?\d\d?)\.){3}(2[0-4]\d|25[0-5]|[01]?\d\d?)$/,
	ServerIp : /^((2[0-4]\d|25[0-5]|[01]?\d\d?)\.){3}(2[0-4]\d|25[0-5]|[01]?\d\d?):\d{1,4}$/,
	Asn : /^\d{16}$/,
	Asn10 : /^\d{10}$/,
	Asn12 : /^\d{12}$/,
	Asn16 : /^\d{16}$/,
	Pos : /^\d{12}$/,
	Pos8 : /^\d{8}$/,
	Pos12 : /^\d{12}$/,
	CardPin : /^\d{6}$/,
	OperatorPin : /^[A-Za-z0-9]{4,8}$/,
	OperatorId : /^[A-Za-z0-9]{8}$/,
	UniqueId : /^\d{10}$/,
	Password: /^[\x00-\xff]{4,15}$/,
	CanTrim: /^[ *]|[* ]$/,
	EAIPath: /^\w:(\\[A-Za-z0-9]*)*$/,
	LoginName:/^[0-9a-zA-Z_\.@\-]{2,20}$/,
	isEAIPath : function(str){return this.EAIPath.test(str);},
	isLoginName : function(str){return this.LoginName.test(str);},
	isEmail : function(str){return this.Email.test(str);},
	isDateFormat : function(str){return this.DateFormat.test(str);},
	isDate : function(str){return this.Date.test(str);},
	isDateTime : function(str){return this.DateTime.test(str);},
	isSafe : function(str){return this.UnSafe.test(str);},
	isInt : function(str){return this.Integer.test(str);},
	isLong : function(str){return this.Long.test(str);},
	isDouble : function(str){return this.Double.test(str);},
	isEnglish : function(str){return this.English.test(str);},
	isHalf : function(str){return this.Half.test(str);},
	isHex : function(str){return this.Hex.test(str);},
	isAmount : function(str){return this.Amount.test(str);},
	isZip : function(str){return this.Zip.test(str);},
	isTel : function(str){return this.Tel.test(str);},
	isMobile : function(str){return this.Mobile.test(str);},
	isNumber : function(str){return this.Number.test(str);},
	isNonnegativeInt : function(str){return this.NonnegativeInt.test(str);},
	isPositiveInt : function(str){return this.PositiveInt.test(str);},
	isBankCard : function(str){return this.BankCard.test(str);},
	isCheckNo : function(str){return this.CheckNo.test(str);},
	isIdCard : function(str){return this.IdCard.test(str);},
	isOrgId : function(str){return this.OrgId.test(str);},
	isOrgCode : function(str){return this.OrgCode.test(str);},
	isOfficerId : function(str){return this.OfficerId.test(str);},
	isPassport : function(str){return this.Passport.test(str);},
	isCardBill : function(str){return this.CardBill.test(str);},
	isTime : function(str){return this.Time.test(str);},
	isIp : function(str){return this.Ip.test(str);},
	isServerIp : function(str){return this.ServerIp.test(str);},
	isAsn10 : function(str){return this.Asn10.test(str);},
	isAsn : function(str){
		if (Project && Project.asnLength){
			return this["Asn"+Project.asnLength].test(str);
		}else
			return this.Asn.test(str);
	},
	isPos : function(str){
		if (Project && Project.posUniqueLength){
			return this["Pos"+Project.posUniqueLength].test(str);
		}else
			return this.Pos.test(str);
	},
	isPassword : function(str){return this.Password.test(str);},
	isCanTrim : function(str){return this.CanTrim.test(str);},
	isCardPin : function(str){return this.CardPin.test(str);},
	isOperatorPin : function(str){return this.OperatorPin.test(str);},
	isOperatorId : function(str){return this.OperatorId.test(str);},
	isUniqueId : function(str){return this.UniqueId.test(str);}
}
/**
* 表单的单个元素校验方法
**/
function checkV(obj,checkType,cannotEmpty,description){
	var v = "";
	if(obj)v = obj.value;
	normalStyle(obj);
	/** 非必填项为空时不校验 */
	if(cannotEmpty != true && v == "")return true;
	/** 提交表单时校验必填项，否则不校验 */
	if(cannotEmpty == true && trim(v) == ""){

		if(isCheckForm){
			errorStyle(obj,description?description:"此项数据不能为空");
			return false;
		}
		else{
			return true;
		}
	}
	/** 最多输入字符长度校验 */
	if(checkLength(obj) == false)return false;
	/** 空格校验 */
	if(Validator.isCanTrim(v)){
		obj.value = trim(v);
		v = obj.value;
//		errorStyle(obj,"首尾字符不能是空格");
//		return false;
	}
	var ctype = checkType;
	/** 各类型数据校验 */
	if(ctype=="int"){
		if(!Validator.isInt(v)){
			errorStyle(obj,"请输入一个整数(不超过9位)");
			return false;
		}
	}else if(ctype=="nonnegativeInt"){
		if(!Validator.isNonnegativeInt(v)){
			errorStyle(obj,"请输入一个大于等于0的整数(不超过9位)");
			return false;
		}
	}else if(ctype=="positiveInt"){
		if(!Validator.isPositiveInt(v)){
			errorStyle(obj,"请输入一个大于0的整数(不超过9位)");
			return false;
		}
	}else if(ctype=="time"){
		if(!Validator.isTime(v)){
			errorStyle(obj,"正确的时间格式为：23:59:59");
			return false;
		}
	}else if(ctype=="long"){
		if(!Validator.isLong(v)){
			errorStyle(obj,"请输入一个整数(不超过18位)");
			return false;
		}
	}else if(ctype=="english"){
		if(!Validator.isEnglish(v)){
			errorStyle(obj,"请输入英文字符");
			return false;
		}
	}else if(ctype=="half"){
		if(!Validator.isHalf(v)){
			errorStyle(obj,"请输入英文或数字");
			return false;
		}
	}else if(ctype=="double"){
		if(!Validator.isDouble(v)){
			errorStyle(obj,"请输入一个数字");
			return false;
		}
	}else if(ctype == "email"){
		if(!Validator.isEmail(v)){
			errorStyle(obj,"请输入合法的Email地址");
			return false;
		}
	}else if(ctype == "Asn10"){
		if(!Validator.isAsn10(v)){
			errorStyle(obj,"请输入合法的10位数字");
			return false;
		}
	}else if(ctype == "date"){
		if(!Validator.isDateFormat(v)){
			errorStyle(obj,"正确的日期格式为：2008-08-08");
			return false;
		}
		else if(!Validator.isDate(v)){
			errorStyle(obj,"输入的日期不存在");
			return false;
		}
	}else if(ctype == "dateTime"){
		if(!Validator.isDateTime(v)){
			errorStyle(obj,"正确的时间格式为：2008-08-08 13:01:20");
			return false;
		}
		else if(!Validator.isDate(v)){
			errorStyle(obj,"输入的日期不存在");
			return false;
		}
	}else if(ctype=="pastDate" || ctype=="_pastDate" || ctype=="futureDate" || ctype=="_futureDate"){
/**
 * 校验输入日期与当前日期的比较结果
 * @param date --yyyy-mm-dd格式的字符串
 * @param type:[ "pastDate"   --小于当前日期|
 *   			"_pastDate"   --小于等于当前日期|
 *   			"futureDate"  --大于当前日期|
 *   			"_futureDate" --大于等于当前日期 ]
*/
		//判断格式
		if(!Validator.isDateFormat(v)){
			errorStyle(obj,"正确的日期格式为：2008-08-08");
			return false;
		}
		else if(!Validator.isDate(v)){
			errorStyle(obj,"输入的日期不存在");
			return false;
		}
		var b = v.split("-");
		var c = new Date();
		var inputDay = Date.parse(new Date(b[0],(new Number(b[1]) -1),b[2]));
		var sysDay = Date.parse(new Date(c.getFullYear(),c.getMonth(),c.getDate()));
		//判断大小的逻辑
		if(ctype == "_pastDate" && inputDay > sysDay){
			errorStyle(obj,"此日期必须小于等于当前日期");
			return false;
		}
		if(ctype == "_futureDate" && inputDay < sysDay){
			errorStyle(obj,"此日期必须大于等于当前日期");
			return false;
		}
		if(ctype == "pastDate" && inputDay >= sysDay){
			errorStyle(obj,"此日期必须小于当前日期");
			return false;
		}
		if(ctype == "futureDate" && inputDay <= sysDay){
			errorStyle(obj,"此日期必须大于当前日期");
			return false;
		}
	}else if(ctype=="number"){
		if(!Validator.isNumber(v)){
			errorStyle(obj,"只能输入数字");
			return false;
		}
	}else if(ctype=="zip"){
		if(!Validator.isZip(v)){
			errorStyle(obj,"邮政编码格式不正确");
			return false;
		}
	}else if(ctype=="amount"){
		if(!Validator.isAmount(v)){
			errorStyle(obj,"金额格式不正确或超过长度");
			return false;
		}
	}else if(ctype=="positiveAmount"){
		if(!Validator.isAmount(v)){
			errorStyle(obj,"金额格式不正确或超过长度");
			return false;
		}else if((v) <= 0){
			errorStyle(obj,"金额必须大于0");
			return false;
		}
	}else if(ctype=="nonNegativeAmount") {
		if(!Validator.isAmount(v)){
			errorStyle(obj,"金额格式不正确或超过长度");
			return false;
		}else if(v < 0){
			errorStyle(obj,"金额必须大于等于0");
			return false;
		}
	}else if(ctype=="tel"){
		if(!Validator.isTel(v)){
			errorStyle(obj,"请输入合法的固定电话号码");
			return false;
		}
	}else if(ctype=="mobile"){
		if(!Validator.isMobile(v)){
			errorStyle(obj,"请输入合法的移动电话号码");
			return false;
		}
	}else if(ctype=="phone"){
		if(!Validator.isMobile(v) && !Validator.isTel(v)){
			errorStyle(obj,"请输入合法的电话号码");
			return false;
		}
	}else if(ctype=="cardbill"){
		if(!Validator.isCardBill(v)){
			errorStyle(obj,"请输入合法的单据号(12位数字)");
			return false;
		}
	}else if(ctype=="ip"){
		if(!Validator.isIp(v)){
			errorStyle(obj,"请输入合法的ip地址");
			return false;
		}
	}else if(ctype=="serverIp"){
		if(!Validator.isServerIp(v)){
			errorStyle(obj,"请输入合法的服务器地址");
			return false;
		}
	}else if(ctype=="pos"){
		if(!Validator.isPos(v)){
			errorStyle(obj,"请输入合法的终端号("+(Project && Project.posUniqueLength? Project.posUniqueLength : 12)+"位数字)");
			return false;
		}
	}else if(ctype=="asn"){
		if(!Validator.isAsn(v) || v <=0){
			errorStyle(obj,"请输入合法的卡号("+(Project && Project.asnLength? Project.asnLength : 16)+"位数字)");
			return false;
		}
	}else if(ctype=="cardPin"){
		if(!Validator.isCardPin(v)){
			errorStyle(obj,"请输入合法的卡密码(6位数字)");
			return false;
		}
	}else if(ctype=="operatorPin"){
		if(!Validator.isOperatorPin(v)){
			errorStyle(obj,"请输入合法的操作员密码(4-8位数字、字母)");
			return false;
		}
	}else if(ctype=="password"){
		if(!Validator.isPassword(v)){
			errorStyle(obj,"请输入合法的登录密码(4-15位半角字符)");
			return false;
		}
	}else if(ctype=="operator"){
		if(!Validator.isOperatorId(v)){
			errorStyle(obj,"请输入合法的操作员编号(8位英文或数字)");
			return false;
		}
	}else if(ctype=="uniqueId"){
		if(!Validator.isUniqueId(v)){
			errorStyle(obj,"请输入合法的客户编号(10位数字)");
			return false;
		}
	}else if(ctype=="bankCard"){
		if(!Validator.isBankCard(v)){
			errorStyle(obj,"请输入合法的银行卡号(16或19位数字)");
			return false;
		}
	}else if(ctype=="checkNo"){
		if(!Validator.isCheckNo(v)){
			errorStyle(obj,"支票号只能为英文或数字");
			return false;
		}
	}
	
	/**
	* @param 界面字典code
	* 1,身份证
	* 2,军官证
	* 3,护照
	* 4,营业执照
	* 5,驾驶证
	* 6,组织机构代码证
	**/
	else if(ctype == "1" || ctype == "idCard"){
		if(!Validator.isIdCard(v)){
			errorStyle(obj,"身份证号格式不正确");
			return false;
		}
	}else if(ctype == "2" || ctype == "officerId"){
		if(!Validator.isOfficerId(v)){
			errorStyle(obj,"军官证证件号格式不正确");
			return false;
		}
	}else if(ctype == "3" || ctype == "passport"){
		if(!Validator.isPassport(v)){
			errorStyle(obj,"护照证件号格式不正确");
			return false;
		}
	}else if(ctype == "4" || ctype == "orgId"){
		if(!Validator.isOrgId(v)){
			errorStyle(obj,"营业执照证件号格式不正确，请输入13或15位数字");
			return false;
		}
	}else if(ctype == "5" || ctype == "driverLicense"){
		if(!Validator.isIdCard(v)){
			errorStyle(obj,"驾驶证证件号格式不正确");
			return false;
		}
	}else if(ctype == "6" || ctype == "orgCode"){
		if(!Validator.isOrgCode(v)){
			errorStyle(obj,"组织机构代码证代码格式不正确，注意字母只能大写");
			return false;
		}
	}else if(ctype == "99" || ctype == "certificateNo"){
		if(!Validator.isOrgId(v)&&!Validator.isPassport(v)&&!Validator.isOfficerId(v)&&!Validator.isIdCard(v)){
			errorStyle(obj,"系统支持证件类型包括：身份证号、军官证、护照、营业执照、驾驶证、组织机构代码证；请输入上述类型中的任意一种证件号");
			return false;
		}
	}else if(ctype == "loginName"){
		if(!Validator.isLoginName(v)){
			errorStyle(obj,"登录帐号错误(格式为长度2至20位的数字、英文、“_”、“.”、“@”)");
			return false;
		}
	}else if(ctype == "EAIPath"){
		if(!Validator.isEAIPath(v)){
			errorStyle(obj,"EAI文件路径错误!");
			return false;
		}
	}
	
	normalStyle(obj);
	return true;
}
/**
* 输入字符长度限制校验
**/
function checkLength(obj,len){
	var cLen = 128;
	if(len)cLen = len;
	if(obj.value != null && obj.value != ""){
		if(obj.value.length > cLen){
			errorStyle(obj,"输入数据不能超过"+cLen+"个字符");
			return false;
		}
	}
	return true;
}
/**
* 提示校验错误
**/
var ERROT_STYLE = "error";
var ERROT_INPUT_STYLE = "errorInput";
var CHECK_ICON = appRoot + "images/icon/exclamation.gif";
function errorStyle(obj,msg){

	var eName = obj.name + "_v";
	eName = getFormId(obj) + eName;
	var h = 19;
	var w = 188;
	var no = 30;
	var cname = ERROT_STYLE;
	var oClassName = obj.className;
	if(obj.type == "text" || obj.type == "password"){
		cname = ERROT_INPUT_STYLE;
	}
	
	if(oClassName != "" && oClassName != null){
		obj.className += " " + cname;
	}
	else{
		obj.className = cname;
	}
	if(!$(eName)){
		var span = document.createElement("span");
		span.className = "errorSpan";
		span.id = eName;
		obj.parentNode.insertBefore(span,obj);
		if(msg && msg.length){
			if(msg.length > 0){
				var halfLen = Common.getStrHalfLength(msg)
				if(halfLen < 28){
					w = 20 + halfLen*6;
				}
				else{
					h = (h) * (Math.floor(halfLen/no) + 1);
				}
			}
		}
		var FFStyle = "";
		if(!isIE()){
			FFStyle = "top:2px;left:54px;";
		}
		var html = "<div class=layer1><div class=layer2 style='padding-left:4px;height:"+h+"px;width:"+w+"px;"+FFStyle+"' title='"+msg+"'>";
		html += "<img id=errorImg name=errorImg src='"+CHECK_ICON+"' align='absmiddle'>"+msg;
		html += "<iframe src='" +appRoot+ "common/bg.html?bgheight="+h+"&bgwidth="+(w+2)+"' frameborder=0 style='position:absolute;visibility:inherit;top:0px;left:0px;z-index:-1;overflow:hidden;width:"+(w+4)+"px;height:"+(h+2)+"px;' scrolling=no height='"+(h+2)+"'>";
		html += "</iframe></div></div>";
		span.innerHTML = html;
	}
}
/**
* 获取表单元素所在form的id
**/
function getFormId(obj){
	var str = "";
	var formObj = obj.parentNode;
	var level = 0;

	while(level != 10){
		if(formObj.tagName){
			if(formObj.tagName.toLowerCase() == "form"){
			
				str = formObj.attributes["id"].value;
				return str;
			}
		}
		formObj = formObj.parentNode;
		level++;
	}
	return str;
}
/**
 * 清除一个校验项的校验结果显示
*/
function normalStyle(obj){
	var cname = ERROT_STYLE;
	var oClassName = obj.className;
	if(obj.type == "text" || obj.type == "password"){
		cname = ERROT_INPUT_STYLE;
	}
	if(oClassName != "" && oClassName != null){
		oClassName = oClassName.replace((" " + cname),"");
		oClassName = oClassName.replace(cname,"");
		obj.className = oClassName;
	}
	var eName = obj.name + "_v";
	eName = getFormId(obj) + eName;
	if($(eName)){
		removeNodeById(eName);
	}
}
/**
 * 清除一个表单的校验结果显示
*/
function clearErrorView(formId){
	var form = $(formId);
	for (var i=0;i<form.elements.length;i++){
		var e = form.elements[i];
		if (e.onblur)normalStyle(e);
	}
}
/**
 * 表单校验方法，和checkV方法组合使用
*/
var isCheckForm = false;
function checkForm(form){
	if(typeof form=="string")
		form = $(form);
		
	if(form.innerHTML.indexOf(CHECK_ICON) != -1)return false;
	isCheckForm = true;
	var elems = form.elements;
	var j = 0;
	for(var i=0;i<elems.length;i++){
		if(elems[i].type != "button" && elems[i].type != "reset" && elems[i].type != "submit"){
			//首先对没有校验方法的输入元素进行长度校验
			if(elems[i].type == "text" || elems[i].type == "password" || elems[i].tagName.toLowerCase() == "textarea"){
				if(elems[i].onblur == null || elems[i].onblur == ""){
					if(checkLength(elems[i]) == false){
						elems[i].onblur = new Function("checkV(this,'')");
					}
				}
			}
			if(!elems[i].disabled && elems[i].onblur){
				var eName = form.attributes["id"].value + elems[i].name + "_v";
				try{
					elems[i].focus();
				}catch(e){continue;}
				elems[i].onblur();
				if($(eName)){
					isCheckForm = false;
					return false;
				}
			}
		}
		j = i;
	}
	if(elems[j]){
		if(elems[j].type){
			if(elems[j].type == "button" || elems[j].type == "reset" || elems[j].type == "submit"){
				if(elems[j].disabled != true && elems[j].readonly != true && elems[j].style.display != "none")
					elems[j].focus();
			}
		}
	}
	isCheckForm = false;
	return true;
}

/**
 * 校验起始日期是否大于结束日期
*/
function checkTimeOrder(bObj,eObj){
	var bDate = bObj.value;
	var eDate = eObj.value;
	if(bDate == "" || eDate == ""){
		//normalStyle(bObj);
		//normalStyle(eObj);
		return true;
	}
	//格式错误直接返回
	if(!checkV(bObj,"_pastDate"))return false;
	if(!checkV(eObj,"_pastDate"))return false;
	//大小判断
	bDate = bDate.split("-");
	bDate = Date.parse(new Date(bDate[0],(new Number(bDate[1]) -1),bDate[2]));
	eDate = eDate.split("-");
	eDate = Date.parse(new Date(eDate[0],(new Number(eDate[1]) -1),eDate[2]));
	if( eDate >= bDate){
		normalStyle(bObj);
		normalStyle(eObj);
		return true;
	}
	errorStyle(bObj,"起始日期不能大于结束日期");
	errorStyle(eObj,"结束日期不能小于起始日期");
	return false;
}
function checkDubleObjs(objA,objB,checkTypeA,checkTypeB,cannotEmptyA,cannotEmptyB){
	var v1 = checkV(objA,checkTypeA,cannotEmptyA);
    var v2 = checkV(objB,checkTypeB,cannotEmptyB);
	if(v1 == true && v2 == true){
		return true;
	}
	return false;
}
/**
 * 比较两个对象的值的大小，大小类型的比较适用于整数和浮点数，等于类型的比较适用于任何类型。
 * @param compareType -比较类型[大于:"gt",大于等于:"ge",等于:"e",小于等于"le",小于:"lt"]
*/
function compareValue(objA,objB,compareType,labelA,labelB){
	if(objA.value == "" || objB.value == ""){
		normalStyle(objA);
		normalStyle(objB);
		return true;
	}
	if(compareType == "e" && objA.value != objB.value){
		errorStyle(objA,labelA + "与" +　labelB + "的值不一致");
		errorStyle(objB,labelB + "与" +　labelA + "的值不一致");
		return false;
	}
	var valueA = new Number(objA.value);
	var valueB = new Number(objB.value);
	if(compareType == "gt" && valueA >= valueB){
		errorStyle(objA,labelA + "必须小于" +　labelB);
		errorStyle(objB,labelB + "必须大于" +　labelA);
		return false;
	}
	else if(compareType == "ge" && valueA > valueB){
		errorStyle(objA,labelA + "必须小于等于" +　labelB);
		errorStyle(objB,labelB + "必须大于等于" +　labelA);
		return false;
	}
	if(compareType == "lt" && valueA <= valueB){
		errorStyle(objA,labelA + "必须大于" +　labelB);
		errorStyle(objB,labelB + "必须小于" +　labelA);
		return false;
	}
	else if(compareType == "le" && valueA < valueB){
		errorStyle(objA,labelA + "必须大于等于" +　labelB);
		errorStyle(objB,labelB + "必须小于等于" +　labelA);
		return false;
	}
	else{
		normalStyle(objA);
		normalStyle(objB);
	}
	return true;
}
